home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / math / yplot-0.000 / yplot-0 / yplot-0.9 / Makefile < prev    next >
Encoding:
Makefile  |  1996-06-04  |  26.1 KB  |  615 lines

  1. # ---------------------------------------------------------------------------
  2. #
  3. # Makefile template for a Yorick-based code
  4. #
  5. # $Id: Maketmpl,v 1.1 1993/08/27 18:32:09 munro Exp $
  6. #
  7.  
  8. # You are trying to build a version of Yorick which includes your own
  9. # compiled routines, which you would like to call from the Yorick
  10. # interpreter just like other built-in functions.  (If you are trying
  11. # to build the original version of Yorick at your site, stop.  You
  12. # should be reading the Makefile.in, not this Maketmpl.)
  13.  
  14. # ---------------------------------------------------------------------------
  15. # Compiling and Loading your Special Version of Yorick
  16. # ----------------------------------------------------
  17.  
  18. # The first thing you need to do is to create a directory where you
  19. # can build and debug your special version of Yorick.  I'll call this
  20. # directory Y_BUILD.  Begin by copying this Maketmpl file into your
  21. # Y_BUILD directory.  Change the name of Maketmpl to Makefile.
  22. # Move your source code into the Y_BUILD directory, if it's not there
  23. # already.  You should move anything not related to the one special
  24. # Yorick version you are trying to create out of the Y_BUILD directory
  25. # in order to avoid damaging it.
  26.  
  27. # This Makefile is divided into two sections:
  28. #   (1) A code specific section, which describes how to compile
  29. #       the modules you are trying to add to Yorick.
  30. #       Modify this section to reflect your code.
  31. #   (2) A site specific section, which parametrizes various
  32. #       compiler switches and options, and provides standard
  33. #       make targets for assembling a complete version of Yorick.
  34. #       DO NOT MODIFY this section if you can avoid it.  (If it
  35. #       needs to be fixed, Maketmpl should be fixed.)
  36.  
  37. # The idea is that the site specific section represents the
  38. # platform and operating system dependencies which the person
  39. # who built Yorick had to overcome.  If you keep such dependecies
  40. # out of the code specific section, then it will be easy for you
  41. # to port your code to any platform which already has Yorick:
  42. #
  43. #      make Makefile
  44. #
  45. # will replace the site specific section of your Makefile with the
  46. # one it finds in $(Y_HOME)/Maketmpl.
  47. # The only thing you need to find out in order to port your special
  48. # version to a new platform is the Yorick home directory Y_HOME.
  49. # The name of the Y_HOME directory is
  50. #
  51. #     $(exec_prefix)/yorhome
  52. #
  53. # Where exec_prefix varies from installation to installation.  Sibling
  54. # directories bin and lib of yorhome are also significant during the
  55. # building of your code.
  56.  
  57. # In addition to your Y_BUILD directory, and the public Y_HOME directory,
  58. # you need to be aware of two other directories:
  59. #     Y_SITE    the directory where the machine-independent components
  60. #               of Yorick reside (this may be the same as Y_HOME).
  61. #     Y_LAUNCH  the directory where you put the executable file
  62. #               you are about to build.  (This directory is determined
  63. #               by your version of Yorick when it starts; it may be the
  64. #               same as Y_BUILD.)  If you want to move your version of
  65. #               Yorick to a directory other than Y_BUILD after you
  66. #               have debugged it, see the section "Moving your Special
  67. #               Version of Yorick to Another Directory" below.)
  68. # On my network,
  69. #     Y_HOME = /usr/local/Yorick/1.0/yorhome
  70. #        /usr/local is mounted to one file server of each machine type
  71. #        on the network, so there is one of these per type of machine
  72. #     Y_SITE = /env/Yorick/yorick-1.0/Yorick
  73. #        /env is mounted to a single file server, visible from every
  74. #        machine on the network, whatever type it is
  75.  
  76. # You must set the following variables in order to enable make to build
  77. # your custom version of Yorick:
  78.  
  79. #     Y_HOME
  80. #        the directory where Yorick is installed on this architecture.
  81. #        Run yorick and type "help" to find out where Y_LAUNCH is.
  82. #        Then try   Y_LAUNCH/../yorhome   -- if that exists and is a
  83. #        directory containing Maketmpl, then that is Y_HOME.  Otherwise
  84. #        you need to ask whoever built Yorick at your site.
  85. #        exec_prefix is Y_HOME/..
  86. #     CODE_NAME
  87. #     NON_SHARABLE
  88. #        the name you want to give your custom Yorick version.
  89. #        One of these two should always be the string "unused".
  90. #        You need to make a your first decision here:
  91. #           If your package is intended for use in conjunction with
  92. #           other custom Yorick packages, define CODE_NAME.  With
  93. #           CODE_NAME, make will create a library containing your
  94. #           object code.  This library can be loaded by yourself or
  95. #           others in the future, who wish to include your package in
  96. #           a their own custom version of Yorick.
  97. #           Alternatively, if neither you nor anyone else might be
  98. #           interested in your package at a future time, define
  99. #           NON_SHARABLE instead.  In this case, make will not build a
  100. #           library of your object code, but will instead load it
  101. #           directly into this one custom Yorick.  This would be
  102. #           appropriate if you are just adding one or two simple,
  103. #           special purpose routines to improve Yorick performance
  104. #           on the problem you are currently solving.
  105. #     C_OPTIMIZE
  106. #     F_OPTIMIZE
  107. #        normally set to "-g" (to debug) or "-O" (to optimize), depending
  108. #        on where you are in the code development cycle.  Normally, you
  109. #        would use "-g" until your code is running reliably, then make
  110. #        a final version with "-O" for actual use.  C_OPTIMIZE can be
  111. #        any flags you want to pass to the C compiler, and F_OPTIMIZE can
  112. #        be any flags you want to pass to the FORTRAN compiler.
  113. #     OBJS
  114. #        the list of object files to be built from source code in this
  115. #        directory.  C source code should reside in files ending with
  116. #        ".c" (or ".h" for header files); FORTRAN source file names should
  117. #        end with ".f".  The OBJS are a space delimited list of files
  118. #        ending with ".o" with prefixes matching the the ".c" or ".f"
  119. #        files you want to compile.  The OBJS list can be continued onto
  120. #        multiple lines by putting a backslash "\" at the end of the
  121. #        incomplete lines.
  122. #     CODE_LIBRARY
  123. #        If you selected CODE_NAME, set this to the name of the library you
  124. #        want your OBJS placed in.  Library names must begin with "lib"
  125. #        and end with ".a".  If you selected NON_SHARABLE, set CODE_LIBRARY
  126. #        to "unused.a".
  127. #     PKG_LIBS
  128. #     PKG_OBJS
  129. #        If you set CODE_LIBRARY to, say, "libmy_code.a", then PKG_LIBS
  130. #        should be set to "-lmy_code", so that your library will be
  131. #        loaded.  If you are loading other custom Yorick libraries along
  132. #        with your own, you must include their directories and library
  133. #        names after your own.  Dependent libraries must be listed before
  134. #        the libraries on which they depend.
  135. #        In addition to libraries, you may want to load other object files;
  136. #        if so, list them under PKG_OBJS.  You must use at least
  137. #        "$(OBJS) $(YWRAP_O)"
  138. #        If you are loading other people's Yorick packages (see Y_OTHERS
  139. #        below), you need to include their libraries in PKG_LIBS (as well
  140. #        as their include files in Y_OTHERS).  By default, this Makefile
  141. #        will look in the following places for the libraries it needs:
  142. #             .            (that is, Y_BUILD)
  143. #             Y_HOME/../lib
  144. #             Y_HOME/../contrib
  145. #        If you are using loading a package which has not been put in
  146. #        one of these three places, you must provide a "-Ldirectory -lpkg"
  147. #        in PKG_LIBS.  Otherwise, "-lpkg" will be sufficient.
  148. #        If other people might want to use your package, you will make
  149. #        it easier for them to port their code to another platform if
  150. #        you put your library in one of the Y_HOME directories.  If you
  151. #        don't, you are forcing them to hunt for it on each platform.
  152. #     Y_INCLUDE
  153. #        In order to link your compiled routines to the Yorick interpreter,
  154. #        you need to write a Yorick include file "my_code.i" -- put the
  155. #        name of this file in the Y_INCLUDE variable.  (You could put more
  156. #        than one file here.)  This file is a part of your source code, and
  157. #        should be present in the Y_BUILD directory.  Yorick must find
  158. #        this file (or a soft link to it) in one of the following three
  159. #        places when it starts (it looks in this order):
  160. #             $(Y_LAUNCH)
  161. #             $(Y_SITE)/startup
  162. #             $(Y_SITE)/contrib
  163. #        If a few other people at your site might be interested in loading
  164. #        Yorick versions which use your package, put the file into
  165. #        $(Y_SITE)/contrib.  If most or many people need your package,
  166. #        arrange to have my_code.i put into $(Y_SITE)/startup.
  167. #        If other people might want to use your package, you will make
  168. #        it easier for them to port their code to another platform if
  169. #        you put your include file in one of the Y_SITE directories.  If
  170. #        you don't, you are forcing them to hunt for it on each platform.
  171. #     Y_OTHERS
  172. #        You may want to load packages you wrote previously, or that
  173. #        someone else has written.  If so, the name of the associated
  174. #        "my_code.i" file(s) must go in the Y_OTHERS variable (space
  175. #        delimited).  All these files must be found in either $(Y_LAUNCH),
  176. #        $(Y_SITE), or $(Y_SITE)/contrib when your special Yorick starts.
  177. #        Therefore, if the author hasn't placed them in one of the
  178. #        Y_SITE directories, you must copy them (or make soft links
  179. #        to them) in your Y_LAUNCH directory.  You must also have copies
  180. #        (or links) to them in Y_BUILD, so that the codger code generator
  181. #        can find them at compile time.  If they are in either of the
  182. #        Y_SITE directories, you needn't worry about this detail.
  183. #     YWRAP_O
  184. #        Your ".i" file will normally include one "PROTOTYPE" comment for
  185. #        each compiled function you want to call from the interpreter.
  186. #        In this case, a wrapper function is automatically generated for
  187. #        each of your functions.  These wrappers will be compiled into
  188. #        an object file called "ywrap.o", which should be the value of the
  189. #        YWRAP_O variable.  If you have written your own wrapper functions,
  190. #        so that there are no "PROTOTYPE" comments in your ".i" file, you
  191. #        should set YWRAP_O to nil, so that make doesn't try to generate
  192. #        wrappers for you.
  193. #     SYS_LIBS
  194. #        if your code requires any additional system libraries (beyond
  195. #        -lX11 -lm -lc), list them here.  Dependent libraries must be
  196. #        listed before the libraries on which they depend.  Appropriate
  197. #        -L options must be included to specify the directories in which
  198. #        your libraries may be found.  Fortran uses additional libraries.
  199. #        If any of your source code is Fortran, put "$(FORTRAN_LIBS)"
  200. #        to get the basic libraries needed by the Fortran on whatever
  201. #        platform you are compiling on.  Some platforms may have additional
  202. #        requirements; finding these anew on each platform you port to is
  203. #        one of the joys of Fortran programming.
  204. #     FORTRAN_STYLE
  205. #        New code should be written in ANSI C, which is far more portable
  206. #        than Fortran.  The major portability problem in Fortran is that
  207. #        the "double precision" data type is necessary on workstations,
  208. #        but produces useless code on Crays.  If your Fortran code
  209. #        declares all real variables "double precision", try setting
  210. #        FORTRAN_STYLE to "$(WKS_FORTRAN)", and it may compile "as is"
  211. #        on a Cray.  Conversely, if real variables are declared "real",
  212. #        try a FORTRAN_STYLE of "$(CRAY_FORTRAN)".  If you can't get one
  213. #        choice to work on all platforms, you will be stuck with maintaining
  214. #        a separate version of your Fortran source for each platform.  Since
  215. #        the Crays are the only deviant machine now, and since there are
  216. #        some workstations for which there is no possible $(CRAY_FORTRAN)
  217. #        switch, I strongly urge you to use only $(WKS_FORTRAN)
  218. #     CLEAN_UP
  219. #     TIDY_UP
  220. #        Put any special filenames to be removed by the "clean" and "tidy"
  221. #        targets here.  Don't worry about object files, library files,
  222. #        and the like -- clean and tidy already know about them.
  223.  
  224. # After you have set all of these variables, in the next section of this
  225. # Makefile, you need to describe the "targets" which make will build.
  226. # The whole custom Yorick code "my_code", each object file ".o", and
  227. # the library "libmy_code.a" containing those object files are the
  228. # targets you are mostly interested in.
  229.  
  230. #     all::
  231. #        The first target is always "all::".  It is special; it's what
  232. #        happens when you just type "make".  If you selected the CODE_NAME
  233. #        variable, use that version of "all::"; if you selected NON_SHARABLE
  234. #        use the other version.
  235. #     distrib::
  236. #        A distrib target is handy for cutting a compressed tar file
  237. #        suitable for moving this code to other sites.  See the sample.
  238. #     my_obj.o:  my_head1.h my_head2.h
  239. #        Each of your C source files should have a line like this one
  240. #        stating its (local) header dependencies, if any.  You might want to
  241. #        include special compile instructions (usually -D macro definitions)
  242. #        here as well.  FORTRAN source usually doesn't need either
  243. #        dependencies or special compile instructions; you don't need
  244. #        to list any specific ".o" targets for such sources.
  245.  
  246. # ---------------------------------------------------------------------------
  247. # Moving your Special Version of Yorick to Another Directory
  248. # ----------------------------------------------------------
  249.  
  250. # If Y_BUILD is not where you want your special version of Yorick,
  251. # you should move the include file(s) mentioned in Y_INCLUDE into
  252. # either $(Y_SITE)/contrib (if only a few other people might be
  253. # interested in using your package), or $(Y_SITE)/startup (if most or
  254. # many custom Yorick builders will use your package).  The constraint is
  255. # that all of the include files your version needs to start (Y_INCLUDE
  256. # and Y_OTHERS) must be either in one of those directories, or in
  257. # the Y_LAUNCH directory (see the discussion of Y_INCLUDE above).
  258. # You should move your package library into either $(Y_HOME)/../lib or
  259. # $(Y_HOME)/../contrib, corresponding to the include file(s).
  260.  
  261. # ---------------------------------------------------------------------------
  262. # Porting your Special Version of Yorick to Another Machine
  263. # ---------------------------------------------------------
  264.  
  265. # After saving your executable (my_code) and library (libmy_code.a),
  266. # do a
  267. #      make clean
  268. # Then use the tar utility to make a copy of Y_BUILD:
  269. #      cd ..
  270. #      tar cvf my_code.tar My_code
  271. # (assuming My_code is the name of your Y_BUILD directory).
  272. # Move my_code.tar to the new platform and type:
  273. #      tar xvf my_code.tar
  274. #      rm my_code.tar
  275. #      cd My_code
  276. # Then edit Makefile, replacing the one line which sets exec_prefix with
  277. # the pathname of the Yorick home directory on the new platform.
  278. # Exit the editor and type:
  279. #      make Makefile
  280. #      make
  281. #      make tidy
  282. # If necessary, move your include file(s) into Y_SITE (or its contrib)
  283. # and your libraries into Y_HOME/../lib (or its contrib), and you are done.
  284.  
  285. # ---------------------------------------------------------------------------
  286. # Moving a Special Yorick Executable File to Another Network
  287. # ----------------------------------------------------------
  288.  
  289. # You can move your Yorick to the same type of machine on another network
  290. # without having to recompile it.  However, if the Y_SITE directory is
  291. # different on the new network than on the network where you compiled
  292. # your Yorick, you will need to install a soft link to Y_SITE in the
  293. # Y_LAUNCH directory:
  294. #      ln -s $(Y_SITE) $(Y_LAUNCH)/yorick.site
  295. # (Remember, Y_LAUNCH is the directory containing your executable file.)
  296.  
  297. # ---------------------------------------------------------------------------
  298.  
  299. # If you've played your cards right, this is the only line that you
  300. # need to change in order to port your custom version of Yorick to a
  301. # new platform.
  302. exec_prefix = /usr/local
  303. Y_HOME = $(exec_prefix)/yorhome
  304.  
  305. C_OPTIMIZE = -O3
  306. F_OPTIMIZE = -g
  307.  
  308. # This sample custom Yorick is called "my_code" -- switch to your own name.
  309. # CODE_NAME = unused
  310. # NON_SHARABLE = my_code
  311. CODE_NAME = yplot
  312. NON_SHARABLE = unused
  313.  
  314. OBJS = read.o pplot.o
  315.  
  316. # CODE_LIBRARY = unused.a
  317. CODE_LIBRARY = libyplot.a
  318.  
  319. # PKG_LIBS =
  320. # PKG_OBJS = $(OBJS) $(YWRAP_O)
  321. PKG_LIBS = -L. -lyplot
  322. PKG_OBJS =
  323.  
  324. Y_INCLUDE = yplot.i
  325. Y_OTHERS =
  326.  
  327. # YWRAP_O =
  328. YWRAP_O = ywrap.o
  329.  
  330. # SYS_LIBS = $(FORTRAN_LIBS)
  331. SYS_LIBS = -L/usr/local/plplot/lib  -L/usr/X11R6/lib -lX11 -lplplotdX
  332.  
  333. # FORTRAN_STYLE = $(CRAY_FORTRAN)
  334. # FORTRAN_STYLE = $(WKS_FORTRAN)
  335. FORTRAN_STYLE =
  336. #FORTRAN_STYLE = $(CRAY_FORTRAN)
  337.  
  338. # Set any special files to be zapped by the clean and tidy targets.
  339. # (make clean removes both TIDY_UP and CLEAN_UP)
  340. CLEAN_UP = my_code
  341. TIDY_UP=
  342.  
  343. # ---------------------------------------------------------------------------
  344.  
  345. # all:: $(NON_SHARABLE)
  346. all:: $(CODE_LIBRARY) $(CODE_NAME)
  347.  
  348. distrib::
  349.     $(RM) *.tar*
  350.     $(RM) -r My_code
  351.     mkdir My_code
  352.     cp README Makefile *.h *.y *.c *.f my_code.i My_code
  353.     tar -cvf my_code.tar My_code
  354.     gzip my_code.tar
  355.     $(RM) -r My_code
  356.  
  357. install::
  358.     cp yplot ${exec_prefix}/bin
  359.     cp yplot.i ${exec_prefix}/Yorick/startup
  360. # Note: indirectly included headers separated by three spaces
  361.  
  362. read.o: read.c
  363.     $(CC) $(CFLAGS) -I/usr/local/plplot/include -c read.c
  364. pplot.o: pplot.c
  365.     $(CC) $(CFLAGS) -I/usr/local/plplot/include -c pplot.c
  366.  
  367. # ---------------------------------------------------------------------------
  368.  
  369. # Do not modify or remove the following line.
  370. # --END-CODE-SPECIFIC-SECTION-----------------END-CODE-SPECIFIC-SECTION--
  371. # -BEGIN-SITE-SPECIFIC-SECTION---------------BEGIN-SITE-SPECIFIC-SECTION-
  372. # Do not modify or remove the preceding line.
  373.  
  374. # If you are creating a Makefile starting from the Maketmpl in order
  375. # to build a special version of Yorick, then
  376.  
  377. #       TRY HARD NOT TO MODIFY ANYTHING BELOW THIS POINT.
  378.  
  379. # The configure script in the Yorick distribution should be able to do
  380. # most of this correctly.  Exceptions are the Fortran section and the
  381. # Y_LD variable; see the README in the top level distribution directory.
  382.  
  383. # ---------------------------------------------------------------------------
  384. # This Makefile is divided into two (hopefully independent) parts:
  385. # This second section is a site-specific section, which should not
  386. # differ among various Yorick-based codes at a particular site.
  387. # The first section describes how to build the Yorick-based code
  388. # contained in this directory.
  389. # The two parts divide between the lines which look like
  390. #                 END-CODE-SPECIFIC-SECTION           and 
  391. #                BEGIN-SITE-SPECIFIC-SECTION
  392.  
  393. # Generic make targets defined below--
  394. # $(CODE_NAME):     (builds my_code custom version of Yorick)
  395. # $(CODE_LIBRARY):  (builds my_code library)
  396. # clean::           (removes everything except source code)
  397. # tidy::            (removes backups and object files)
  398. # Makefile::        (to port this Makefile to another site)
  399. # tags:             (make TAGS file for GNU Emacs)
  400. # index:            (make index file for vgrind C beautifier)
  401.  
  402. # ---------------------------------------------------------------------------
  403.  
  404. # The following paths may be set by the configure script:
  405.  
  406. # This should ALWAYS be an absolute path name beginning with /
  407. # NEVER relative path names beginning with . or ..
  408. prefix = /usr/local
  409.  
  410. # I don't know whether these do what they're supposed to do (for autoconf).
  411. srcdir = .
  412.  
  413. # Directory which will contain the architecture-independent parts of
  414. # the public Yorick.
  415. Y_SITE = $(prefix)/Yorick
  416.  
  417. # Directories for the architecture-dependent parts of Yorick
  418. Y_BINDIR = $(exec_prefix)/bin
  419. Y_LIBDIR = $(exec_prefix)/lib
  420. Y_CONTRIBDIR = $(exec_prefix)/contrib
  421.  
  422. # These are separate variables so they can be
  423. # overridden on the make command line
  424. YORINCL = -I$(Y_HOME)
  425. YORLIB = -L$(Y_LIBDIR)
  426. GISTINCL = -I$(Y_HOME)
  427. GISTLIB = -L$(Y_LIBDIR)
  428. Y_CONTRIB_LIB = -L$(Y_CONTRIBDIR)
  429.  
  430. # Filled in by configure script
  431. XLOAD = 
  432.  
  433. # ---------------------------------------------------------------------------
  434.  
  435. # Redefine these to nil to get a no-graphics version of Yorick.
  436. GRAPH_LIBS = $(GISTLIB) -lgist $(XLOAD)
  437. # Solaris needs:    -lsocket -lnsl -lw -lintl -ldl
  438. # when loading with -Bstatic   -- however, Sun doesn't supply libdl.a!?
  439. GRAPH_I = graph.i
  440. GRAPH_O = graph.o graph0.o
  441.  
  442. # ---------------------------------------------------------------------------
  443.  
  444. # Choose C compiler appropriate to this machine - must be an ANSI C compiler
  445. CC = gcc
  446. DEFS =  -DSTDC_HEADERS=1 
  447. CFLAGS = $(C_OPTIMIZE) $(DEFS) $(D_SIZE_T) -I$(srcdir) $(YORINCL)
  448.  
  449. LDOPTS = 
  450. LD_OPTIMIZE = $(C_OPTIMIZE)
  451. LDFLAGS = $(LD_OPTIMIZE) $(LDOPTS)
  452.  
  453. # Usage:   $(Y_LD) $(OBJS) $(LIBS)
  454. Y_LD = $(CC) $(LDFLAGS) -o $@
  455.  
  456. # The lowest level (last) libraries required on the load line go here.
  457. # LOWLIBS = -lm -lc            (if Y_LD is not your C compiler)
  458. LOWLIBS = -lm 
  459.  
  460. .c.o:
  461.     $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
  462. .c:
  463.     $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
  464.  
  465. # Some versions of make have an implicit rule to make .i from .c
  466. .c.i:
  467.     @touch $<
  468.  
  469. # ---------------------------------------------------------------------------
  470.  
  471. # Repeat for FORTRAN compiler
  472. FC = f77
  473. FFLAGS = $(F_OPTIMIZE) $(FORTRAN_STYLE)
  474.  
  475. # See comment at top of Maketmpl about FORTRAN_STYLE
  476. # CRAY_FORTRAN = -r8 -i4       Sun SPARC workstation
  477. # CRAY_FORTRAN = +autodbl4     HP PA-RISC workstation (OS<=8)
  478. # CRAY_FORTRAN = -R8           HP PA-RISC workstation (OS>=9)
  479. #             doesn't really work, and +autodblpad is totally wrong
  480. # This is the most important case, since Crays are the only deviants:
  481. # CRAY_FORTRAN =
  482. # WKS_FORTRAN = -dp            UNICOS Crays
  483. CRAY_FORTRAN = -r8 -i4
  484. WKS_FORTRAN =
  485.  
  486. # (May be best to leave these commented out...)
  487. # .f.o:
  488. #     $(FC) $(FFLAGS) -c $<
  489. # .f:
  490. #     $(FC) $(FFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
  491.  
  492. # Since the rule used to build the custom Yorick version generally
  493. # uses the C compiler to load, the user will need to select the
  494. # FORTRAN libraries explicitly.  Yorick packages should generally
  495. # avoid FORTRAN I/O, so I don't put the I/O library here...
  496. # FORTRAN_LIBS = -lf77                Sun SPARC workstation
  497. #      On Suns, use ar to remove the file main.o from the libF77.a
  498. #      in /usr/lang.  Call the result libf77.a and put it in Y_HOME.
  499. #      Also, Sun FORTRAN uses yacc to stupidly cause a yyparse and
  500. #      yylex to appear if you use any formatted I/O -- needless to
  501. #      say, this conflicts with Yorick's parser.  I could also use
  502. #      macros to redefine these names in yorick.y/yorick.c...
  503. # FORTRAN_LIBS = -lF77                Sun SPARC workstation (someday)
  504. # FORTRAN_LIBS = -lM77 -lF77          Solaris
  505. # FORTRAN_LIBS = -lvec -lcl           HP PA-RISC workstation
  506. # FORTRAN_LIBS = -l??                 IBM workstations
  507. # FORTRAN_LIBS = -lf                  UNICOS Crays
  508. FORTRAN_LIBS = -lf2c
  509.  
  510. # Codger, Yorick's automatic wrapper and initialization code generator,
  511. # understands four possible FORTRAN external name linkage conventions:
  512. # All lowercase or all uppercase, with or without a trailing underscore.
  513. # Use exactly one of the following lines:
  514. # FORTRAN_LINKAGE = -Df_linkage
  515. # FORTRAN_LINKAGE = -Df_linkage_
  516. # FORTRAN_LINKAGE = -DF_LINKAGE
  517. # FORTRAN_LINKAGE = -DF_LINKAGE_
  518. FORTRAN_LINKAGE = -Df_linkage_
  519.  
  520. # ---------------------------------------------------------------------------
  521.  
  522. # The timing routines in sysdep.c are a perennial problem.  The default
  523. # is POSIX 1003.1 standard, but this doesn't work on Suns...
  524. # You will need to edit sysdep.c if neither of these works.
  525. # HAS_BSD_TIMER = -DBSD_TIMER
  526. # HAS_BSD_TIMER =
  527. HAS_BSD_TIMER = 
  528.  
  529. # Other utilities
  530.  
  531. SHELL = /bin/sh
  532. MAKE = make
  533. RM = rm -f
  534. MV = mv
  535. SED = sed
  536.  
  537. AR = ar
  538. # If your ar does not take the "l" flag (local temporary files), use this.
  539. # ARFLAGS = rc
  540. ARFLAGS = rcl
  541.  
  542. RANLIB = ranlib
  543.  
  544. # ---------------------------------------------------------------------------
  545.  
  546. # If you are editing the original Yorick Makefile, you are done.
  547.  
  548. # ---------------------------------------------------------------------------
  549.  
  550. CODGER = $(Y_HOME)/codger
  551.  
  552. # A generic main.o is located in Y_HOME, along with main.c.
  553. # yinit.o is made by Codger from ycode.c, which will include all the
  554. # packages specified as Y_INCLUDE, plus the std.i package in Y_HOME.
  555. MAIN_OBJS = $(Y_HOME)/main.o yinit.o $(PKG_OBJS)
  556.  
  557. # ---------------------------------------------------------------------------
  558. # The first three targets are generic rules for building the custom code
  559. # and the package library required for inserting this package into any
  560. # version of Yorick, in combination with other packages.
  561.  
  562. OTHER_LIBS = $(GRAPH_LIBS) $(SYS_LIBS) $(LOWLIBS)
  563. ALL_LIBS = -L. $(Y_CONTRIB_LIB) $(YORLIB) $(PKG_LIBS) -lyor $(OTHER_LIBS)
  564.  
  565. $(NON_SHARABLE): $(MAIN_OBJS)
  566.     $(Y_LD) $(MAIN_OBJS) $(ALL_LIBS)
  567.  
  568. $(CODE_NAME): $(MAIN_OBJS) $(CODE_LIBRARY)
  569.     $(Y_LD) $(MAIN_OBJS) $(ALL_LIBS)
  570.  
  571. # The ywrap.o file is generated by Codger from ycode.c, as controlled
  572. # by the Y_INCLUDE variable.
  573. $(CODE_LIBRARY): $(OBJS) $(YWRAP_O)
  574.     $(AR) $(ARFLAGS) $@ $(OBJS) $(YWRAP_O)
  575.     $(RANLIB) $@
  576.  
  577. Makefile::
  578.     @echo "Merging $(Y_HOME)/Maketmpl with ./Makefile"
  579.     $(SED) -n -e '1,/^# --END-CODE/p' ./Makefile >M.1
  580.     $(SED) -n -e '/^# -BEGIN-SITE/,$$p' $(Y_HOME)/Maketmpl >M.2
  581.     cat M.1 M.2 >Makefile
  582.     $(RM) M.1 M.2
  583.  
  584. # The Codger code generator produces a single output file ycode.c
  585. # which must be compiled into two object files -- ywrap.o to be
  586. # included in an object file library for a Yorick package, and
  587. # yinit.o to be loaded into a specific version of Yorick.
  588. ycode.c: $(Y_INCLUDE)
  589.     $(CODGER) $(Y_SITE) $(Y_INCLUDE) - $(GRAPH_I) $(Y_OTHERS)
  590. ywrap.o: ycode.c $(Y_INCLUDE)
  591.     $(CC) $(CPPFLAGS) $(CFLAGS) -DYWRAP_C -c ycode.c
  592.     $(MV) ycode.o ywrap.o
  593. yinit.o: ycode.c $(Y_INCLUDE)
  594.     $(CC) $(CPPFLAGS) $(CFLAGS) -DYINIT_C -c ycode.c
  595.     $(MV) ycode.o yinit.o
  596.  
  597. # Housekeeping targets--
  598. #   make clean        to wipe everything but source files
  599. #   make tidy         to clean out junk, but leave executables and libraries
  600. clean: tidy
  601.     $(RM) *.a $(CLEAN_UP)
  602.  
  603. tidy:
  604.     $(RM) ycode.c *.o *~ *.bak core $(TIDY_UP)
  605.  
  606. # TAGS table for Emacs
  607. tags:
  608.     etags -tw *.h *.c *.y
  609.  
  610. # index for vgrind (a pretty C printing routine)
  611. index:
  612.     etags -twv *.h *.c >index
  613.  
  614. # ---------------------------------------------------------------------------
  615.